package com.service.hibernate.dao;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;


import org.hibernate.Session;
import org.hibernate.Transaction;

import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;
import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;
import com.service.hibernate.pojos.Employees;

 





public class EmployeeDAO {
	
	 
	@SessionTarget
	Session session;
	
	@TransactionTarget
	Transaction transaction;
	
	@SuppressWarnings("unchecked")
	public List<Employees> getEmployee(int id){
		List<Employees> emp=new ArrayList<Employees>();
		try {
			String query="FROM Employees where id="+id;
			System.out.println(query);
			emp=session.createQuery(query).list();
		} catch (Exception e) {
			System.out.println("Error in retriving data");
			e.printStackTrace();
		}
		return emp;
	}
	
	
	
}
